package com.itmg.analyze.jp.url.impl;

import org.apache.log4j.Logger;
import com.itmg.analyze.jp.bean.YahooParaBean;
import com.itmg.analyze.jp.model.YahooSearchParamModel;
import com.itmg.analyze.jp.url.IURLAnalyze;
import com.itmg.vo.SearchParameterVO;
import com.itmg.vo.TargetDataVO;

/**
 *  获得匹配好的url
 * 
 * @author xuehaipeng
 * @version 1.0
 * */

public class YahooURlAnlyzeImpl implements IURLAnalyze {
	protected Logger log = Logger.getLogger(YahooURlAnlyzeImpl.class.getName());
	private String rootURL = "http://shopping.yahooapis.jp/ShoppingWebService/V1/itemSearch";
	private String developID = "7SR.K62xg671znW2mW6wiwOl.WNkq3l9En75hYxHOke59NqJhPtBqI_FHa1w9it1";
	private Integer hits = 20;
	private String sourceSiteName = "psearch.yahoo.co.jp";
	public YahooURlAnlyzeImpl() {
		// TODO Auto-generated constructor stub
	}
	public TargetDataVO getURLDataByParameter(SearchParameterVO searchParameterVO) throws Exception {
		YahooSearchParamModel yahooSearchParamModel = YahooParaBean.getYahooSearchParamModel(searchParameterVO);
		yahooSearchParamModel.setAppid(developID);
		yahooSearchParamModel.setHits(hits);
		TargetDataVO targetDataVO = new TargetDataVO();
		targetDataVO.setSourceSiteName(sourceSiteName);
		targetDataVO.setUrl(rootURL+yahooSearchParamModel.getURLPara());
log.info(targetDataVO.getUrl());
		return targetDataVO;
	}
}
